#include "Avalon/IO/BufferWriter.hpp"

using namespace Avalon;
using namespace Avalon::IO;
using namespace Avalon::Threading;
using namespace boost;

BufferWriter::BufferWriter() {}

BufferWriter::~BufferWriter() {}

const Buffer& BufferWriter::GetBuffer() const {
  return m_buffer;
}

void BufferWriter::Write(const void* data, int size,
    Out<Async<void> > result) {
  m_buffer.Append(data, size);
  result->SetResult();
}

void BufferWriter::Write(const Buffer& data, Out<Async<void> > result) {
  m_buffer.Append(data);
  result->SetResult();
}
